import { observable, action } from 'mobx'

class SocketModel {
  @observable isCreatedOrg = false;
  @observable isCreatedConsortium = false;
  @observable createChannel = false; // 创建通道
  @observable peerNodeJoinChannel = false; // peer节点加入通道
  @observable installChaincode = false; // 安装链码
  @observable deployChaincode = false; // 部署链码
  @observable upgradeChaincode = false; // 升级链码
  @observable checkPeerStatus = null;
  @observable isCreateQuorum = false; // 网络列表状态
  @observable socket = ''
  @action setSocket(socket) {
    this.socket = socket
  }
  @action getSocket() {
    return this.socket
  }
  @action getIsCreatedOrg() {
    return this.isCreatedOrg
  }
  @action setIsCreatedOrg(value) {
    return this.isCreatedOrg = value
  }
  @action getIsCreatedConsortium() {
    return this.isCreatedConsortium
  }
  @action setIsCreatedConsortium(value) {
    return this.isCreatedConsortium = value
  }
  @action getIsCheckPeer() {
    return this.checkPeerStatus
  }
  @action setIsCheckPeer(value) {
    return this.checkPeerStatus = value
  }
  @action setKey(key, value) {
    return this[key] = value
  }
  @action getIsCreateQuorum() {
    return this.isCreateQuorum
  }
  @action setIsCreateQuorum(value) {
    return this.isCreateQuorum = value
  }
}

export default new SocketModel()

